
default: all

CC = g++

source = $(wildcard ./*.cpp)
exercises = $(basename $(source))

define compile_template
$(1).out: $(1).cpp
	$$(CC) -o $$@ $$^
endef

$(foreach exercise,$(exercises),$(eval $(call compile_template,$(exercise))))

out = $(addsuffix .out, $(exercises))

all: $(out)

.PHONE: clean

clean:
	rm *.out